package com.viki.test.testvisitinternet;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class AccessHttpsWithAuthorityActivity extends Activity {
	private TextView mTxtView;
	private ArrayList<AddressContainer> mItems = new ArrayList<AddressContainer>() {
		private static final long serialVersionUID = 1L;
		{
			add(new AddressContainer("https://www.verisign.com", null, null));
			add(new AddressContainer("https://martinreichart.com/_tmpdata/login_valid.json", null, null));
			add(new AddressContainer("https://smilingmobile.gicp.net:1216/svn/Projects/trunk/scm_test/branches", "lynn", "123654"));
			add(new AddressContainer("http://192.168.1.114:8080/manager/html", "tomcat", "tomcat"));
		}
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.accesshttpswithauthority);
		Button visitBtn = (Button) findViewById(R.id.visit);
		visitBtn.setOnClickListener(mVisitClickListener);
		mTxtView = (TextView) findViewById(R.id.result);
	}
	private OnClickListener mVisitClickListener = new OnClickListener() {
		
		@Override
		public void onClick(View v) {
			String result = HttpUtil.sendPost(mItems.get(3).mAddress, null, null);
			mTxtView.setText(result);
		}
	};
	private class AddressContainer {
		private String mAddress;
		private String mUsername;
		private String mPwd;
		public AddressContainer(String mAddress, String mUsername, String mPwd) {
			super();
			this.mAddress = mAddress;
			this.mUsername = mUsername;
			this.mPwd = mPwd;
		}
	}
	
}
